//
//  NSString+ContentSize.m
//  GiftBox
//
//  Created by 康健 on 15/12/1.
//  Copyright © 2015年 xinyihezi. All rights reserved.
//

#import "NSString+ContentSize.h"

@implementation NSString(ContentSize)
- (CGSize)contentSizeWithFont:(UIFont *)font maxSize:(CGSize)maxSize {
    CGSize size;
    NSDictionary * dic = [NSDictionary dictionaryWithObjectsAndKeys:font,NSFontAttributeName, nil];
    size = [self boundingRectWithSize:maxSize
                              options:NSStringDrawingTruncatesLastVisibleLine|NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading
                           attributes:dic
                              context:nil].size;
    return size;
}
@end
